<template>
  <el-table
    :data="filteredData ? filteredData : data"
    :height="height"
    style="width: 100%"
  >
    <el-table-column prop="itemName" label="认定原因" width="340" />

    <el-table-column label="次数">
      <el-table-column prop="sgCount" label="数量" />

      <el-table-column label="比上年">
        <el-table-column prop="sgCountSub" label="同期增减" />
      </el-table-column>

      <el-table-column label="增减">
        <el-table-column prop="sgCountYOY" label="百分百" />
      </el-table-column>
    </el-table-column>

    <el-table-column label="死亡人数">
      <el-table-column prop="swrsCount" label="数量" />

      <el-table-column label="比上年">
        <el-table-column prop="swrsCountSub" label="同期增减" />
      </el-table-column>

      <el-table-column label="增减">
        <el-table-column prop="swrsCountYOY" label="百分百" />
      </el-table-column>
    </el-table-column>

    <el-table-column label="受伤人数">
      <el-table-column prop="ssrsCount" label="数量" />

      <el-table-column label="比上年">
        <el-table-column prop="ssrsCountSub" label="同期增减" />
      </el-table-column>

      <el-table-column label="增减">
        <el-table-column prop="ssrsCountYOY" label="百分百" />
      </el-table-column>
    </el-table-column>
  </el-table>
</template>

<script setup>
const props = defineProps({
  data: {
    type: Array,
  },
  height: {
    type: Number,
  },
  type: {
    type: String,
  },
  name: {
    type: String,
  },
});
const filteredData = computed(() => {
  if (props.type === "Vehicle") {
    return props.data.filter((item) => item.itemName === props.name);
  }
});
</script>

<style lang="less" scoped></style>
